package cn.anc.aonicardv.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.Nullable;
import cn.anc.aonicardv.util.StatusBarUtil;

/**
 * function :
 * </p>
 * Created by aoni123@anc.cn on 2020/8/12.
 */
public class StatusBarView extends View {

    public StatusBarView(Context context) {
        super(context);
    }

    public StatusBarView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public StatusBarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int width = MeasureSpec.getSize(widthMeasureSpec);

        int height = StatusBarUtil.getStatusBarHeight(getContext());
        setMeasuredDimension(width, height);
    }

    public boolean isVisibility() {
        return getVisibility() == VISIBLE;
    }

    public void setVisibility(boolean visible) {
        setVisibility(visible ? VISIBLE : GONE);
    }
}
